<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateTableMedias extends Migration
{

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //
        if (Schema::hasTable('medias')) {
            Schema::create('medias', function (Blueprint $table) {
                $table->increments('id');
                $table->string('hash')->unique();
                $table->bigInteger('user_id')->nullable();
                $table->string('file_path');
                $table->string('file_name');
                $table->bigInteger('file_size')->default(0);
                $table->string('caption')->nullable();
                $table->text('description')->nullable();
                $table->text('tag')->nullable();
                $table->string('type', 20)->default('image/jpeg');
                $table->softDeletes();
                $table->timestamps();
            });
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }

}
